package gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.media.opengl.GL;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLPbuffer;
import javax.media.opengl.glu.GLU;
import javax.swing.ImageIcon;
import javax.swing.Timer;
import com.sun.opengl.util.Screenshot;
import util.BasicGraphicsJogl;

public class ShapedFrameImage extends ShapedFrame
{
    private BufferedImage displayImage=null;
    public ShapedFrameImage(boolean draggable)
    {
        super(draggable);
        setPreferredSize(new Dimension(500,500));
        pack();
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        setVisible(true);
        
    }
    @Override
    public void paint(Graphics g)
    {
        super.paint(g);
        Graphics2D g2d = (Graphics2D) g;
        if(displayImage!=null)
        {
            g2d.drawImage(displayImage, 0, 0, 500, 500, null);
        }
        else
        {
            g2d.setColor(new Color(1.0f,0.0f,0.0f));
            g2d.fillRoundRect(0, 0, 500, 500,100,100);
        }
        
//        g2d.drawImage(image, 0, 0, image.getWidth(null), image.getHeight(null), null);
//        BasicGraphicsJogl basicGraphics = BasicGraphicsJogl.instance();
        
    }
    public void setImage(BufferedImage displayImage)
    {
        this.displayImage = displayImage;
    }

    

}
